# require 'exception_notification/sidekiq'

ExceptionTrack.configure do
  # environments for store Exception log in to database.
  # default: [:development, :production]
  self.environments = %i(production)
end

# ExceptionNotification.configure do |config|
#   config.ignored_exceptions += %w(ActionView::TemplateError
#                                   ActionController::InvalidAuthenticityToken
#                                   ActionController::BadRequest
#                                   ActionView::MissingTemplate
#                                   ActionController::UrlGenerationError
#                                   ActionController::UnknownFormat)
# end
module ExceptionNotifier
  class ExceptionTrackNotifier


    def headers_for_env(env)
      return '' if env.blank?
      custom_info = env["exception_notifier.exception_data"]
      headers = []
      headers << "Method:     #{env['REQUEST_METHOD']}"
      headers << "URL:        #{env['rack.url_scheme']}://#{env['HTTP_HOST']}#{env['REQUEST_URI']}"
      headers << "User-Agent: #{env['HTTP_USER_AGENT']}"
      headers << "Language:   #{env['HTTP_ACCEPT_LANGUAGE']}"
      headers << "Server:     #{Socket.gethostname}"
      headers << "Process:    #{$$}"
      custom_info && custom_info.each do |k, v|
        headers << "#{k}: #{v}"
      end

      headers.join("\n")
    end
  end
end